home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-12-16 | 23.0 KB | 724 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: Frame.cpp
- // Release Version: $ ODF 3 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "Container.hpp"
-
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef DEFINES_K
- #include "Defines.k"
- #endif
-
- #ifndef COMMANDS_H
- #include "Commands.h"
- #endif
-
- #ifndef SELECT_H
- #include "Select.h"
- #endif
-
- #ifndef PROXY_H
- #include "Proxy.h"
- #endif
-
- #ifndef VIEW_H
- #include "View.h"
- #endif
-
- #ifndef CONTENT_H
- #include "Content.h"
- #endif
-
- // ----- Framework Layer -----
-
- #ifndef FWCONTXT_H
- #include "FWContxt.h"
- #endif
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWPRESEN_H
- #include "FWPresen.h"
- #endif
-
- #ifndef FWSCROLR_H
- #include "FWScrolr.h"
- #endif
-
- #ifndef FWSCLBAR_H
- #include "FWSclBar.h"
- #endif
-
- #ifndef FWGROWBX_H
- #include "FWGrowBx.h"
- #endif
-
- #ifndef FWFCTCLP_H
- #include "FWFctClp.h"
- #endif
-
- #ifndef FWSUUTIL_H
- #include "FWSUUtil.h"
- #endif
-
- #ifndef FWSUSINK_H
- #include "FWSUSink.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWMENU_H
- #include "FWMenu.h"
- #endif
-
- #ifndef FWRECSHP_H
- #include "FWRecShp.h"
- #endif
-
- #ifndef FWODGEOM_H
- #include "FWODGeom.h"
- #endif
-
- #ifndef FWRGNSHP_H
- #include "FWRgnShp.h"
- #endif
-
- #ifndef FWGC_H
- #include "FWGC.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_Module_OpenDoc_Commands_defined
- #include <CmdDefs.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh>
- #endif
-
- #ifndef SOM_ODSession_xh
- #include <ODSessn.xh>
- #endif
-
- #ifndef SOM_ODDispatcher_xh
- #include <Disptch.xh>
- #endif
-
- //========================================================================================
- // Runtime Information
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfcontainer
- #endif
-
- FW_DEFINE_CLASS_M4(CContainerFrame, FW_CEmbeddingFrame, FW_MDraggableFrame, FW_MDroppableFrame, FW_MContainingPropertiesFrame)
- FW_DEFINE_AUTO(CContainerFrame)
-
- //========================================================================================
- // CContainerFrame
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::CContainerFrame
- //----------------------------------------------------------------------------------------
-
- CContainerFrame::CContainerFrame(Environment* ev,
- ODFrame* odFrame,
- FW_CPresentation* presentation,
- CContainerPart* part) :
- FW_CEmbeddingFrame(ev, odFrame, presentation, part),
- FW_MDraggableFrame(ev, this),
- FW_MDroppableFrame(ev, this),
- fContainerPart(part),
- fSelection((CContainerSelection*)GetPresentation(ev)->GetSelection(ev)),
- fZoomFactor(FW_kFixedPos1)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::~CContainerFrame
- //----------------------------------------------------------------------------------------
-
- CContainerFrame::~CContainerFrame()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::DoAdjustMenus
- //----------------------------------------------------------------------------------------
-
- FW_Handled CContainerFrame::DoAdjustMenus(Environment* ev, FW_CMenuBar* menuBar, FW_Boolean hasMenuFocus, FW_Boolean isRoot)
- {
- FW_UNUSED(isRoot);
- // ----- Edit Menu -----
- if (hasMenuFocus)
- {
- menuBar->EnableCommand(ev, kODCommandPaste, HasPropertyOnClipboard(ev, kODPropContents, NULL)); // we don't care about the type
-
- ODTypeToken viewType = 0;
- if (fSelection->Count() == 1)
- {
- CProxy* proxy = fSelection->GetFirstSelectedProxy();
- FW_ASSERT(proxy);
- viewType = proxy->GetViewAs();
- }
- else if (fSelection->Count() == 0)
- {
- viewType = GetPresentation(ev)->GetDefaultEmbeddedFrameViewType(ev);
- }
-
- menuBar->EnableAndCheckCommand(ev, cAsFrame, TRUE, viewType == FW_CPart::fgViewAsFrameToken);
- menuBar->EnableAndCheckCommand(ev, cAsLargeIcon, TRUE, viewType == FW_CPart::fgViewAsLargeIconToken);
- menuBar->EnableAndCheckCommand(ev, cAsSmallIcon, TRUE, viewType == FW_CPart::fgViewAsSmallIconToken);
- menuBar->EnableAndCheckCommand(ev, cAsThumbnail, TRUE, viewType == FW_CPart::fgViewAsThumbnailToken);
-
- menuBar->EnableAndCheckCommand(ev, cZoom50, TRUE, fZoomFactor == FW_DoubleToFixed(.5));
- menuBar->EnableAndCheckCommand(ev, cZoom100, TRUE, fZoomFactor == FW_kFixedPos1);
- menuBar->EnableAndCheckCommand(ev, cZoom200, TRUE, fZoomFactor == FW_IntToFixed(2));
- }
-
- return FW_kNotHandled;
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::ChangeZoomFactor
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::ChangeZoomFactor(Environment* ev, FW_Fixed zoomFactor)
- {
- fZoomFactor = zoomFactor;
-
- AdjustContentViewSize(ev, FW_kDontRedraw);
-
- FW_ASSERT(GetScroller(ev));
- GetScroller(ev)->ScaleBy(ev, FW_CPoint(zoomFactor, zoomFactor)); // Will invalidate
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::DoMenu
- //----------------------------------------------------------------------------------------
-
- FW_Handled CContainerFrame::DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent)
- {
- FW_Handled handled = FW_kHandled;
-
- ODCommandID commandID = theMenuEvent.GetCommandID(ev);
- switch (commandID)
- {
- case cZoom50:
- if (fZoomFactor != FW_DoubleToFixed(0.5))
- ChangeZoomFactor(ev, FW_DoubleToFixed(0.5));
- break;
- case cZoom100:
- if (fZoomFactor != FW_kFixedPos1)
- ChangeZoomFactor(ev, FW_kFixedPos1);
- break;
- case cZoom200:
- if (fZoomFactor != FW_IntToFixed(2))
- ChangeZoomFactor(ev, FW_IntToFixed(2));
- break;
-
- case cAsFrame:
- ChangeEmbeddedViewType(ev, FW_CPart::fgViewAsFrameToken);
- break;
- case cAsLargeIcon:
- ChangeEmbeddedViewType(ev, FW_CPart::fgViewAsLargeIconToken);
- break;
- case cAsSmallIcon:
- ChangeEmbeddedViewType(ev, FW_CPart::fgViewAsSmallIconToken);
- break;
- case cAsThumbnail:
- ChangeEmbeddedViewType(ev, FW_CPart::fgViewAsThumbnailToken);
- break;
-
- default:
- handled = FW_kNotHandled;
- }
-
- return handled;
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::ChangeEmbeddedViewType
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::ChangeEmbeddedViewType(Environment* ev, ODTypeToken viewAs)
- {
- GetPresentation(ev)->SetDefaultEmbeddedFrameViewType(ev, viewAs);
-
- if (fSelection->Count() != 0)
- {
- FW_CCommand* command = FW_NEW(CViewAsCommand, (ev, fContainerPart, this, fSelection, viewAs));
- command->Execute(ev);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::NewClipboardCommand
- //----------------------------------------------------------------------------------------
-
- FW_CClipboardCommand* CContainerFrame::NewClipboardCommand(Environment* ev, ODCommandID commandID)
- {
- return FW_NEW(CClipboardCommand, (ev, commandID, fContainerPart, this, fSelection, FW_kCanUndo));
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::NewInsertCommand
- //----------------------------------------------------------------------------------------
-
- FW_CInsertCommand* CContainerFrame::NewInsertCommand(Environment* ev, const FW_PFileSpecification& fileSpec)
- {
- return FW_NEW(CInsertCommand, (ev, this, fileSpec, fSelection, FW_kCanUndo));
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::DoActivateEvent
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::DoActivateEvent(Environment* ev, const FW_CActivateEvent& theActivateEvent)
- {
- FW_UNUSED(theActivateEvent);
-
- if (HasSelectionFocus(ev))
- fSelection->InvalidateSelectionHandles(ev, this);
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::CanAcceptDrop
- //----------------------------------------------------------------------------------------
-
- ODDragResult CContainerFrame::CanAcceptDrop(Environment* ev, ODDragItemIterator* dragInfo)
- {
- FW_UNUSED(ev);
- FW_UNUSED(dragInfo);
- return TRUE;
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::AdjustZoomedWindowSize
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::AdjustZoomedWindowSize(Environment* ev, FW_CPoint& proposedSize)
- {
- FW_UNUSED(ev);
- proposedSize = fContainerPart->GetDrawingSize();
- proposedSize.x *= fZoomFactor;
- proposedSize.y *= fZoomFactor;
-
- FW_CPoint sbSize = FW_CScrollBar::GetDefaultScrollBarSize();
-
- proposedSize.x += sbSize.x + FW_IntToFixed(3); // I want to leave a little space around
- proposedSize.y += sbSize.y + FW_IntToFixed(3);
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::AdjustWindowGrowLimits
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::AdjustWindowGrowLimits(Environment* ev, FW_CPoint& minSize, FW_CPoint& maxSize)
- {
- FW_UNUSED(ev);
- FW_UNUSED(maxSize);
- FW_CPoint sbSize = FW_CScrollBar::GetDefaultScrollBarSize();
-
- minSize.x = FW_IntToFixed(72) + sbSize.x;
- minSize.y = FW_IntToFixed(72) + sbSize.y;
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::ExternalizeProperties
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::ExternalizeProperties(Environment* ev, ODStorageUnit* su)
- {
- ::FW_SUAddPropValue(ev, su, kBackgroundColorProp, kBackgroundColorValue);
-
- FW_PStorageUnitSink suSink(ev, su, kBackgroundColorProp, kBackgroundColorValue);
- FW_CWritableStream stream(suSink);
-
- stream << fContainerPart->GetBackgroundColor();
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::GeometryChanged
- //----------------------------------------------------------------------------------------
- // the geometry (clip shape, external or Internal transform) of one of my facet or one of my
- // embedding facet as changed
-
- void CContainerFrame::GeometryChanged(Environment* ev,
- ODFacet* odFacet,
- FW_Boolean clipShapeChanged,
- FW_Boolean externalTransformChanged)
- {
- FW_CEmbeddingFrame::GeometryChanged(ev, odFacet, clipShapeChanged, externalTransformChanged);
-
- FW_CFacetClipper facetClipper;
- facetClipper.ClipEmbeddedFacets(ev, this, odFacet, NULL);
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::PostCreateViewFromStream
- //----------------------------------------------------------------------------------------
- // PostCreateViewFromStream is called after subviews are created from resources.
- // Add code which cannot be handled by current resource types.
-
- void CContainerFrame::PostCreateViewFromStream(Environment* ev)
- {
- // ----- Remove the grow-box and scroll-bars from non-root (i.e. embedded) frames
- // ("delete" will also remove a view from the list of subviews for that frame)
- if (IsRoot(ev) == false)
- {
- // Remove the GrowBox
- FW_CView* growBox = FindViewByID(ev, kGrowBoxID);
- FW_ASSERT(growBox);
- delete growBox;
-
- // Remove the scroll-bars from the scroller and then delete them
- FW_CScrollBarScroller* scroller = FW_DYNAMIC_CAST(FW_CScrollBarScroller, GetScroller(ev));
- FW_ASSERT(scroller);
- FW_CScrollBar* hSB = scroller->GetScrollBar(ev, FW_kHorizontal);
- FW_CScrollBar* vSB = scroller->GetScrollBar(ev, FW_kVertical);
-
- scroller->RemoveScrollBar(ev, FW_kHorizontal);
- scroller->RemoveScrollBar(ev, FW_kVertical);
-
- delete hSB;
- delete vSB;
- }
-
- // WARNING: Make sure that classes created from resources won't be dead-stripped
- FW_DO_NOT_DEAD_STRIP(FW_CGrowBox);
- FW_DO_NOT_DEAD_STRIP(FW_CScrollBarScroller);
- FW_DO_NOT_DEAD_STRIP(FW_CScrollBar);
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::CreateSubViews
- //----------------------------------------------------------------------------------------
- #if 0
- // NOTE: This method is not used by default because views are created from resources.
- // It was left to show how to create views by program instead of using resources.
-
- void CContainerFrame::CreateSubViews(Environment* ev)
- {
- FW_CRect frameRect = GetBounds(ev);
- FW_CRect contentRect = GetContentRect(ev);
-
- FW_CPoint drawingSize = fContainerPart->GetDrawingSize();
-
- // ----- Create the content view -----
- FW_CRect drawViewBounds(contentRect);
- if (drawViewBounds.Width() > drawingSize.x)
- drawViewBounds.right = drawViewBounds.left + drawingSize.x;
- if (drawViewBounds.Height() > drawingSize.y)
- drawViewBounds.bottom = drawViewBounds.top + drawingSize.y;
-
- CContainerView* contentView = new CContainerView(ev, this, drawViewBounds, drawingSize, fContainerPart);
- contentView->BecomeContentView(ev);
-
- FW_CScrollBar* vertSB = NULL;
- FW_CScrollBar* horzSB = NULL;
- // ----- Create scroll bars and grow box in root frame only -----
- if (IsRoot(ev))
- {
- // ----- Create the vertical scroll bar
- FW_CRect vertSbRect(contentRect.right, frameRect.top - FW_kFixedPos1,
- frameRect.right + FW_kFixedPos1, contentRect.bottom + FW_kFixedPos1);
- vertSB = FW_NEW(FW_CScrollBar, (ev, this, 0, vertSbRect));
-
- // ----- Create the horizontal scroll bar
- FW_CRect horzSbRect(frameRect.left - FW_kFixedPos1, contentRect.bottom,
- contentRect.right + FW_kFixedPos1, frameRect.bottom + FW_kFixedPos1);
- horzSB = FW_NEW(FW_CScrollBar, (ev, this, 0, horzSbRect));
-
- // ----- Create the GrowBox gadget
- FW_CGrowBox* growBox = new FW_CGrowBox(ev, this, 0, contentRect.BotRight());
- }
-
- // ----- add a scroller to the Frame -----
- FW_CScroller* scroller = FW_NEW(FW_CScrollBarScroller, (ev, this, horzSB, vertSB));
- AdoptScroller(ev, scroller);
- }
- #endif
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::GetContentRect
- //----------------------------------------------------------------------------------------
-
- FW_CRect CContainerFrame::GetContentRect(Environment* ev) const
- {
- FW_CRect contentRect = GetBounds(ev);
-
- if (IsRoot(ev))
- {
- FW_CPoint sbSize = FW_CScrollBar::GetDefaultScrollBarSize();
-
- contentRect.bottom -= sbSize.y;
- contentRect.right -= sbSize.x;
- }
-
- return contentRect;
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::AdjustContentViewSize
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::AdjustContentViewSize(Environment* ev, FW_ERedrawVerb redraw)
- {
- FW_CRect contentRect = GetContentRect(ev);
-
- FW_CPoint drawingSize = fContainerPart->GetDrawingSize();
-
- // ----- I need to take into account the zoom factor -----
- drawingSize.x *= fZoomFactor;
- drawingSize.y *= fZoomFactor;
-
- FW_CPoint drawViewSize(FW_Minimum(drawingSize.x, contentRect.Width()),
- FW_Minimum(drawingSize.y, contentRect.Height()));
-
- FW_CPoint currentSize = GetContentView(ev)->GetSize(ev);
- if (currentSize != drawViewSize)
- {
- GetContentView(ev)->SetSize(ev, drawViewSize, redraw);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::Draw
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::Draw(Environment* ev, ODFacet* odFacet, ODShape* invalidShape)
- {
- FW_CViewContext vc(ev, this, odFacet, invalidShape);
-
- FW_CSuperView* contentView = GetContentView(ev);
- FW_CRect contentRect = GetContentRect(ev);
- FW_CRect contentBounds = contentView->GetBounds(ev);
-
- // Note: in this container we always have contentRect == contentBounds because the
- // content view takes up the whole space, so we could remove this Draw method.
- // We left it to show you what could be done to draw in the frame outside the
- // content view (see also the Draw example)
- if (contentRect != contentBounds)
- {
- FW_CAcquiredODShape shape1 = ::FW_NewODShape(ev, contentRect);
- FW_CAcquiredODShape shape2 = ::FW_NewODShape(ev, contentBounds);
- shape1->Subtract(ev, shape2);
-
- FW_CRegionShape::RenderRegion(vc, shape1, FW_kFill, FW_kRGBLightGray);
-
- contentBounds.Inset(FW_kFixedNeg1, FW_kFixedNeg1);
- FW_CRectShape::RenderRect(vc, contentBounds, FW_kFrame);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::DoMouseDownInEmbeddedFrameBorder
- //----------------------------------------------------------------------------------------
-
- FW_Handled CContainerFrame::DoMouseDownInEmbeddedFrameBorder(Environment* ev,
- const FW_CBorderMouseEvent& theBorderMouseEvent)
- {
- FW_gClosedHandCursor.Select();
-
- Drag(ev, theBorderMouseEvent);
-
- return FW_kHandled;
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::DoMouseDownInEmbeddedFrame
- //----------------------------------------------------------------------------------------
-
- FW_Handled CContainerFrame::DoMouseDownInEmbeddedFrame(Environment* ev, const FW_CEmbeddedMouseEvent& theEmbeddedMouseEvent)
- {
- FW_Handled handled = FW_kNotHandled;
-
- if (theEmbeddedMouseEvent.GetNumberOfClicks(ev) > 1)
- {
- OpenSelection(ev);
- handled = FW_kHandled;
- }
-
- return handled;
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::NewDragCommand
- //----------------------------------------------------------------------------------------
-
- FW_CDragCommand* CContainerFrame::NewDragCommand(Environment* ev, FW_CFrame* theFrame, const FW_CMouseEvent& theMouseEvent)
- {
- FW_UNUSED(theMouseEvent);
- return FW_NEW(CDragCommand, (ev, fContainerPart, theFrame,
- fSelection,
- FW_kCanUndo));
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::NewDropCommand
- //----------------------------------------------------------------------------------------
-
- FW_CDropCommand* CContainerFrame::NewDropCommand(Environment* ev,
- FW_CFrame* frame,
- ODDragItemIterator* dropInfo,
- ODFacet* facet,
- const FW_CPoint& dropPoint)
- {
- return FW_NEW(CDropCommand, (ev, fContainerPart, frame,
- dropInfo, facet, dropPoint,
- FW_kCanUndo));
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::ExternalizeFrame
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::ExternalizeFrame(Environment* ev, ODStorageUnitView* storageUnitView)
- {
- FW_CEmbeddingFrame::ExternalizeFrame(ev, storageUnitView);
-
- FW_PStorageUnitSink suSink(ev, storageUnitView);
- FW_CWritableStream stream(suSink);
-
- stream << fZoomFactor;
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::InternalizeFrame
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::InternalizeFrame(Environment* ev, ODStorageUnitView* storageUnitView)
- {
- FW_CEmbeddingFrame::InternalizeFrame(ev, storageUnitView);
-
- FW_PStorageUnitSink suSink(ev, storageUnitView);
- FW_PBufferedSink sink(ev, suSink);
- FW_CReadableStream stream(sink);
-
- stream >> fZoomFactor;
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::FocusStateChanged
- //----------------------------------------------------------------------------------------
-
- void CContainerFrame::FocusStateChanged(Environment* ev, ODTypeToken focus, FW_Boolean newState, ODFrame* newOwner)
- {
- FW_CEmbeddingFrame::FocusStateChanged(ev, focus, newState, newOwner);
-
- if (focus == FW_CPart::fgSelectionFocusToken)
- {
-
- // this may be called when we have not facets, if a containing part detatches
- // this without first getting the focus. In that case, there's no window!
-
- FW_CWindow* wind = GetWindow(ev);
- if (wind && wind->IsActive(ev))
- fSelection->InvalidateSelectionHandles(ev, this);
- /*
- // • If I get the selection focus I redraw the handles only if the window is not active
- // if the window is active they already have been redrawn by DoActivateEvent
- // • If I am loosing the selection focus I redraw the handles only if the window is active
- // if the window is not active they already have been redrawn by DoActivateEvent
- // The events order is:
- // - Window 1 deactivated
- // - Frame 1 lose selection focus
- // - Frame 2 gain selection focus
- // - Window 2 activated
- FW_Boolean windowActive = GetWindow(ev)->IsActive(ev);
- FW_Boolean hilite = newState ? !windowActive : windowActive;
- if (hilite)
- fSelection->RenderAllHandles(ev, this);
- */
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CContainerFrame::EmbeddedFrameRequested
- //----------------------------------------------------------------------------------------
-
- FW_MProxy* CContainerFrame::EmbeddedFrameRequested(Environment *ev,
- FW_MProxy* baseProxy,
- ODFrame* baseFrame,
- ODShape* frameShape,
- ODPart* embeddedPart,
- ODTypeToken viewType,
- ODTypeToken presentation,
- ODID frameGroupID,
- FW_Boolean isOverlaid,
- FW_Boolean isSubFrame)
- {
- FW_UNUSED(baseFrame);
- FW_UNUSED(frameShape);
- FW_CPresentation* myPresentation = GetPresentation(ev);
-
- CProxy* theBaseProxy = (CProxy*)baseProxy;
- FW_CRect embeddedFrameBounds = theBaseProxy->GetBounds(ev);
-
- embeddedFrameBounds.Offset(embeddedFrameBounds.Width(), FW_kFixed0);
-
- CProxy* proxy = new CProxy(ev, embeddedFrameBounds, fContainerPart, viewType);
-
- FW_CRect tempRect(embeddedFrameBounds);
- tempRect.Place(FW_kFixed0, FW_kFixed0);
- FW_CAcquiredODShape aqFrameShape = ::FW_NewODShape(ev, tempRect);
-
- FW_TRY
- {
- proxy->EmbedPart(ev,
- myPresentation,
- embeddedPart,
- kODFrameObject,
- aqFrameShape,
- viewType,
- presentation,
- frameGroupID,
- isOverlaid,
- isSubFrame);
- }
- FW_CATCH_BEGIN
- FW_CATCH_EVERYTHING ()
- {
- proxy->Release();
- FW_THROW_SAME ();
- }
- FW_CATCH_END
-
- // ----- Now I can add it to my data
- fContainerPart->AddProxyToPart(ev, proxy);
-
- // AddShapeToPart acquired proxy. Since this function is actually returning
- // an FW_MProxy, which is currently not refcounted, the caller (which is
- // happens to be a framework method) can't be counted on to release, so we
- // have to do so for it.
-
- proxy->Release();
-
- // ----- Clip the facets -----
- FW_CFacetClipper facetClipper;
- FW_CAcquiredODShape limitShape = ::FW_NewODShape(ev, embeddedFrameBounds);
- facetClipper.Clip(ev, myPresentation, limitShape);
-
- return proxy;
- }
-